<?php

	/**
	 * Workspace@ Engine application comment!
	 * 
	 * LICENSE
	 * This application is licensed under New BSD license.
	 * Please read complete LICENSE.txt inside of root folder for more details.
	 * 
	 * We wish you good building :) 
	 * 
	 * @category   Application
	 * @package    Bootstrap
	 * @author     Nevio Vesic <nevio@workspaceat.com>
	 * @copyright  2008-2009 Workspace@ group in association with Design strategist
	 */

	class Engine_Plugins_Js extends Engine_Application_Abstract
	{
		
		const JS_EXT  = ".js";
		
		/**
		 * Load javascript template
		 *
		 * @param array $data
		 */
		public function load( Array $files )
		{
			$jsdata = array();
			
			foreach ( $files as $key => $subkey )
			{
				$jsdata[] = $this->jsFolder() . $key . self::JS_EXT;
				
				if ( $subkey )
				{
					foreach ( $subkey as $items )
					{
						$jsdata[] = $this->jsFolder() . $items . self::JS_EXT;
					}
				}
			}
			
			require_once "Js/LoadTemplate.phtml";
		}
		
		/**
		 * Get current js folder path
		 *
		 * @return string
		 */
		public function jsFolder()
		{
			return self::$system -> enviroment -> url . self::$system -> js -> rootdir . "/";
		}
	}

